﻿//Notifier related
function showNotifier(){
	var item = new ContentItem();
	item.heading = GADGET_NAME;
	if (options.getValue("minutes")>1){
		var min=MINUTES;
	}else{
		var min=MINUTE;
	}
	item.snippet=TIME_TO+" "+NEXT_GULP+" "+options.getValue("minutes")+" "+min;
	plugin.AddContentItem(item, gddItemDisplayAsNotification);

}
//Sound related
var curAudioClip_ = null;

function playSound(){
  try{
	if (curAudioClip_ == null) {      // Not playing anything
    curAudioClip_ = framework.audio.play("water.mp3", onAudioStateChange); 
  } else {                  // Already playing something
    curAudioClip_.stop();
    curAudioClip_ = null;
  }
	}catch(e){
	//
	}
}

function onAudioStateChange(audioClip, state) {
  try{
	if (state == gddSoundStateStopped) {
    curAudioClip_ = null;
  } else if (state == gddSoundStatePlaying) {
    //
  }
	}catch(e){
	//
	}
}
